<template>
  <div class="container">
    <el-container>
      <el-header class="head">
        <div class="head-left"></div>
        <div class="head-right">
          <div class="head-m-btn">
            <img class="head-m-image" src="../../assets/gitee.png" @click="onOpenGitee">
          </div>
        </div>
      </el-header>
    </el-container>
      
    <el-main>
      <div class="card-container">
        <el-card 
          v-for="(item, index) in list" 
          :key="index"
          @click="onclick(item)"
        >
          <div class="card-content">
            {{item.name}}
            <img class="el-card-container-img" :src="item.icon">
          </div>
        </el-card>
      </div>
    </el-main>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          name: '多语言JSON',
          icon: require("@/assets/icon3.png"),
          url: '/exceltojson'
        },
        {
          name: 'BMFont合成',
          icon: require("@/assets/icon0.png"),
          url: '/pages/bmfont/bmfont'
        },
        {
          name: 'BMFont生成',
          icon: require("@/assets/icon1.png"),
          url: 'https://snowb.org/',
        },
        {
          name: '字符串去重',
          icon: require("@/assets/icon2.png"),
          url: '/pages/uniquestr/uniquestr'
        }
      ]
    }
  },
  onLoad() {},
  methods: {
    onclick(item) {
      window.location.href = item.url;
    },
    onOpenGitee() {
      window.location.href = 'https://gitee.com/uni-app_6/vue-tools';
    }
  }
}
</script>

<style>
body {
  background: #1a1a1a;
  margin: 0;
  padding: 0;
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
}

.el-container {
  width: 100%;
  height: 100%;
}
.el-main {
  margin: 60px;
}
/* 卡片容器 */
.card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem; /* 增大间距 */
  justify-content: center; /* 卡片居中 */
}

/* 卡片样式 */
.el-card {
  position: relative; /* 确保绝对定位的图片相对于卡片定位 */
  /* 其他原有样式保持不变 */
  width: 480px;
  /* padding: 20px; */
  border-radius: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 180px;
}

.el-card:hover {
  transform: translateY(-5px); /* 悬停效果 */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); /* 更强的阴影 */
}

.el-card-container-img {
  position: absolute;
  width: 60px;
  height: 60px;
  bottom: 20px;
  right: 20px;
  object-fit: contain;
  transition: all 0.3s ease;
  opacity: 0.9;
}

.el-card:hover .el-card-container-img {
  opacity: 1;
  transform: scale(1.1);
}

.head {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d9d9d9;
  color: #d9d9d9;
  position: fixed;
  z-index: 99;
  box-sizing: border-box;
  width: 100%;
}

.head-left {
}

.head-right {
  display: flex;
}

.head-m-btn {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
}

.head-m-image {
  margin-left: 10px;
  width: 30px;
  height: 30px;
  border-radius: 20px;
}
</style>